﻿<Page
    x:Class="BuddyTracker.Views.LoginPageTwitter"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BuddyTracker.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"    
    xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
    xmlns:core="using:Microsoft.Xaml.Interactions.Core"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
    DataContext="{Binding Source={StaticResource Locator}, Path=Main}"
    >

    <interactivity:Interaction.Behaviors>
        <core:EventTriggerBehavior EventName="Loaded">
            <core:InvokeCommandAction
                                    Command="{Binding LoginOnNavigatedToCommand, Mode=OneWay}"/>
        </core:EventTriggerBehavior>
        <core:EventTriggerBehavior EventName="Unloaded">
            <core:InvokeCommandAction
                                    Command="{Binding LoginOnNavigatedFromCommand, Mode=OneWay}"/>
        </core:EventTriggerBehavior>

    </interactivity:Interaction.Behaviors>
    
    

    <Grid Background="#FF1DCAFF">
        <Grid.RowDefinitions>
            <RowDefinition Height="1*" />
            <RowDefinition Height="9*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="10" />
            <ColumnDefinition Width="5*"/>
            <ColumnDefinition Width="3*"/>
        </Grid.ColumnDefinitions>

        <TextBox InputScope="Number" Text="{Binding TwitterPin, Mode=TwoWay}"  x:Name="txtPIN" Grid.Column="1" VerticalAlignment="Center"/>
        <Button x:Name="btnAuth" Command="{Binding AuthTwitterCommand}" HorizontalAlignment="Center"  x:Uid="btnAuth" Grid.Column="2"/>
        <WebView Grid.Row="1" Grid.ColumnSpan="3" VerticalAlignment="Stretch" Margin="0,5,0,0" Source="{Binding TwitterLoginUri}" />

    </Grid>
</Page>
